﻿<?php
	//ob_start('compress_page');
	require_once(CONTROLLER_DIR.'/template/header_page.phtml');
	require_once('news_list_seo.phtml');
?>
<script>
	function getContent(page)
	{
		<?php
			if($type == 'news')
				echo "var getURL = 'ajax/news.php?type=news&page='+page";
				
			if($type == 'video')
				echo "var getURL = 'ajax/news.php?type=video&page='+page";
			
			if($type == 'doc')
				echo "var getURL = 'ajax/news.php?type=doc&page='+page";
		?>
		
		$.get(getURL, function(data) 
		{
			if(data.length > 10)
			{
				$('.pageitem-current').removeClass('pageitem-current');
				$('#products-accordion-content').hide('fast');
				$('#products-accordion-content').html(data);
				$('#products-accordion-content').show('fast');
				$('#page'+page).addClass('pageitem-current');
			}
			else {alert('Không có dữ liệu !');}
		});
	}
</script>
<body>
	
	<div id="wrapper">
	<?php	require_once(CONTROLLER_DIR.'/template/header.phtml'); ?>	
		<div id="content" > 
			<div id="news-list" class="news-list">
				<ul id="product-results" style="">
					<li><h2 style="color:white;margin-bottom:0px">
						<?php
							if($type == 'news') echo "TIN TỨC & SỰ KIỆN";
							if($type == 'video') echo "VIDEO";
							if($type == 'doc') echo "TÀI LIỆU";
						?>
					</h2></li>
					<li class="righthr"></li>
					<li>
						
						<ul id="products-accordion-content">
							<?php 
							foreach($newsArr as $value)
							{
								$url = NewsUrl($value);
echo "						<li>\n";
echo "							<div class='productinfo'>\n";
echo "								<a title='{$value['news_title']}' href='$url'><img alt='{$value['news_title']}' title='{$value['news_title']}' width='56px' height='56px' src='{$value['news_img']}' class='item'></a>\n";
echo "								<a title='{$value['news_title']}' href='$url'><strong class='itemname'>{$value['news_title']}</strong></a>\n";
$time = DateDisplay($value['news_date']);
echo "								<div class='itemtime'>$time</div>\n"; //
$value['news_description'] = strip_tags($value['news_description']);
echo "								<p>{$value['news_description']}</p>\n";
echo "								<span class='spacer'></span> \n";
echo "							</div>\n";
echo "						</li>\n";
echo "						<li class='righthr'></li>\n";
							}
							?>
						</ul>
					</li>
					
					<li>
						<div id="pages">
							<ul id="ecat-pagination-bottom" class="pagination">
								<?php
									for($i=1; $i<=$numPage;$i++)
									{
										if($i == 1)
											echo "<li class='pageitem'><a id='page$i' href=\"javascript: getContent($i)\" class='pageitem-current'>$i</a></li>\n";
										else
											echo "<li class='pageitem'><a id='page$i' href=\"javascript: getContent($i)\">$i</a></li>\n";
									}
								?>
							</ul>
						</div>
					</li>
					
					
				</ul>
				
			</div>
			
			
			<div id='content-right' style='float:left;'>
				<?php	
					require_once(CONTROLLER_DIR.'/template/wholesale/wholesale.php'); 
					require_once(CONTROLLER_DIR.'/template/ticker/ticker.php'); 
				?>	
				
			</div>
			<div class="spacer"></div>
		</div><!--id: content-->
	<?php require_once(CONTROLLER_DIR.'/template/poster/poster.php'); ?>	
	<?php require_once(CONTROLLER_DIR.'/template/footer.phtml'); ?>	
	</div><!--id: wrapper-->
</body>
</html>
<?php	
	/*  end the buffer, echo the page content  */
	//ob_end_flush();
?>	
